package com.test.mooan.labama.activity_fragment_boom.base_boom;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.test.mooan.labama.bean_boom.user_info_boom.LoginInfo_boom;
import com.test.mooan.labama.utils_boom.analytics_boom.event_boom.IAnalyticsEvent_boom;
import com.test.mooan.labama.utils_boom.analytics_boom.util_boom.AnalyticsUtil_boom;
import com.test.mooan.labama.utils_boom.helper_boom.UserInfoHelper_boom;
import com.test.mooan.labama.utils_boom.http_boom.HttpManager_boom;

import org.json.JSONObject;


public abstract class BaseLoginActivity_boom extends BaseActivity_boom {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public abstract void onRequestOtpCodeResponse_boom(JSONObject jsonObject);

    //登录成功响应
    public void onUserLoginResponse_boom(){
        try {

            //保存登录信息到本地
            UserInfoHelper_boom.gInstance().sToken(LoginInfo_boom.getInstance().gToken());
            UserInfoHelper_boom.gInstance().sUserId(LoginInfo_boom.getInstance().gUserId());
            UserInfoHelper_boom.gInstance().sIsAdSource(LoginInfo_boom.getInstance().gIsAdSource());

            //打点
            String gtype = LoginInfo_boom.getInstance().gType();
            if (gtype.equalsIgnoreCase(UserInfoHelper_boom.LOGIN_TYPE_REGISTER)) AnalyticsUtil_boom.INSTANCE.addEvent(IAnalyticsEvent_boom.AT_REGISTER);

            //登录前初始化
            AnalyticsUtil_boom.INSTANCE.saveFirebaseAndFacebookS2SInfo();

            HttpManager_boom.getInstance().requestUrls();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void onUrlsResponse(){
        HttpManager_boom.getInstance().requestUserProcess();
    }

}